<?php

$username = $_POST['username'];
$password = $_POST['password'];

$sql = mysqli_connect("localhost", "wd", "123456", "wd");
if (!$sql) {
    die("连接数据失败！");
}
$stmt = mysqli_prepare($sql, "select username,password from register where username=? and password=?");
$b=md5($password);
mysqli_stmt_bind_param($stmt, 'ss', $username, $b);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
$rs = mysqli_fetch_assoc($result);

if(!$rs){
    echo "nonentity";
}else{
    echo "yy";
    setcookie("username", "$username", time()+3600);
 
}

